<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn(nums,target){
            for(var i=0;i<nums.length;i++){
                // console.log(nums[i]);
                //里层循环从第二个数开始
                for(var j=i+1;j<nums.length;j++){
                    //列出所有条件
                    if(nums[i]+nums[j]===target){
                        return [i,j]
                    }
                }
            }
        }
       console.log(fn([3,2,4],6)); 
    </script>
</body>
</html>